package cn.lg.soar.system.biz.modules.auth.mapper;

import cn.lg.soar.system.biz.modules.auth.entity.Post;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author luguoxiang
 * @date 2021/8/21
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
public interface PostMapper extends BaseMapper<Post> {

    @Select("SELECT a.post_id FROM lg_sys_user_2_post a " +
            "INNER JOIN lg_sys_post_2_tag b ON a.post_id=b.post_id " +
            "INNER JOIN lg_sys_post_tag c ON b.tag_id=c.id " +
            "WHERE a.org_id=#{orgId} AND c.`code`=#{tagCode}")
    List<Long> idsByOrgAndTag(@Param("orgId") Long orgId, @Param("tagCode") String tagCode);

}
